<html>
<head>
    <meta charset="utf-8">
    <title>我的流程日志</title>
    <#include "/pubHeadStyle.html">
</head>
<body>
    <div style="position: relative;height: 100%;">
        <div class="tablesize roles" style="position: absolute;top:10px;right:10px;bottom: 10px;left: 10px;">
            <table id="processInstanceMyLogTable" lay-filter="processInstanceMyLogTable"></table>
        </div>
    </div>
    <style>
        .btn-class div.layui-layer-btn{
            background-color: #f2f2f2;
        }
        .layui-table-view .layui-form-checkbox[lay-skin=primary] i{
            margin-top: 4px;
        }
    </style>
    <script type="text/html" id="headerToolsBar">
        <div class="layui-btn-container">
            <a class="layui-btn layui-btn-sm" lay-event="query">
                <i class="layui-icon layui-icon-search"></i>
                <span>查询</span>
            </a>
            <a class="layui-btn layui-btn-sm" lay-event="reset">
                <i class="layui-icon layui-icon-refresh"></i>
                <span>重置</span>
            </a>
        </div>
        <form class="layui-form" action="" lay-filter="instanceQueryForm" style="margin-top:10px">
            <div class="table-top-filter">
                <div class="table-filter-alone">
                    <label class="layui-form-label">流程标题</label>
                    <input type="text" name="Q_processSubject_SL" id="processSubject" class="layui-input filter-value" placeholder="流程标题"/>
                </div>
                <div class="table-filter-alone">
                    <label class="layui-form-label">操作类型</label>

                    <select name="Q_operatorType_SN" id="operatorType" class="layui-input filter-value">
                        <option value="">--全部--</option>
                        <option value="0"  >启动流程</option>
                        <option value="1"  >交办</option>
                        <option value="2"  >撤销</option>
                        <option value="25"  >追回</option>
                        <option value="3"  >删除流程实例</option>
                        <option value="4"  >同意(投票)</option>
                        <option value="5"  >反对(投票)</option>
                        <option value="6"  >弃权(投票)</option>
                        <option value="7"  >补签</option>
                        <option value="8"  >驳回</option>
                        <option value="9"  >驳回到发起人</option>
                        <option value="10" >删除任务</option>
                        <option value="11" >代理任务</option>
                        <option value="13" >锁定任务</option>
                        <option value="14" >任务解锁</option>
                        <option value="15" >添加意见</option>
                        <option value="16" >任务指派</option>
                        <option value="17" >设定所有人</option>
                        <option value="18" >结束任务</option>
                        <option value="22" >保存流程草稿</option>
                        <option value="23" >删除流程草稿</option>
                        <option value="25" >追回</option>
                        <option value="26" >任务交接</option>
                    </select>
                </div>
                <div class="table-filter-alone">
                    <label class="layui-form-label">操作时间</label>
                    <input type="text" name="Q_createTime_DL" id="createTime" class="layui-input filter-value"
                           placeholder="开始时间"/>
                </div>
                <div class="table-filter-alone">
                    <label class="layui-form-label" style="text-align: center;">至</label>
                    <input type="text" name="Q_endCreateTime_DG" id="endCreateTime" class="layui-input filter-value"
                           placeholder="结束时间"/>
                </div>
            </div>
        </form>
    </script>



    <script type="text/html" id="bar">
        <a class="layui-btn layui-btn-xs" lay-event="detail">明细</a>
    </script>

    <script>
        layui.config({
            base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
        }).extend({
            index: 'index' //主入口模块
        }).use(['index','table', 'layer', 'util', 'commons', 'setter', 'totalFilter','laydate', 'common'],function () {
            var table = layui.table;
            var layer = layui.layer;
            var util = layui.util;
            var laydate = layui.laydate;
            var $ = layui.$;
            var setter = layui.setter;
            var commons = layui.commons;
            var common = layui.common;
            var totalFilter = layui.totalFilter;

            var tableH = commons.tabHeight();
            loadTable( serverPath.workflowPath+setter.workflowLinkPath+ 'bpmRunLog/myList');
            //全局使用。即所有弹出层都默认采用，但是单个配置skin的优先级更高
            layer.config({
                skin: 'btn-class'
            })
            //第一个实例
            function loadTable(url) {
                table.render({
                    elem: '#processInstanceMyLogTable'
                    ,cellMinWidth: 70
                    , title: '流程操作日志'
                    , height: tableH
                    ,autoSort: false
                    , url: url
                    ,defaultToolbar: ['filter', 'print']
                    , method: 'post'
                    , toolbar: '#headerToolsBar'
                    , page: true
                    , cols: [[
                        {type: 'checkbox', fixed: 'left'}
                        , { field: 'processSubject',title: '流程标题',minWidth: 330,  sort: true, align: 'center'}
                        , {field: 'userName', title: '用户名称', sort: true, align: 'center'}
                        , {field: 'createTime', title: '操作时间',minWidth: 200,sort: true, align: 'center',templet:function(d){
                                if (d.createTime == undefined) {
                                    return "";
                                }else {
                                    return util.toDateString(d.createTime, "yyyy-MM-dd HH:mm:ss");
                                }
                            }}
                        , {field: 'operatorType', title: '操作类型',  sort: true, align: 'center',templet:function(d){
                                if (d.operatorType==0) {return '<span style="color: #15cc08;">启动流程</span>';}
                                if (d.operatorType==1) {return  '<span style="color: #15cc08;">交办</span>';}
                                if (d.operatorType==2) {return '<span style="color: #cc0c00;">撤销</span>';}
                                if (d.operatorType==3) {return '<span style="color: #cc0c00;">删除流程实例</span>';}
                                if (d.operatorType==4) {return '<span style="color: #15cc08;">同意(投票)</span>';}
                                if (d.operatorType==5) {return '<span style="color: #cc0c00;">反对(投票)</span>';}
                                if (d.operatorType==6) {return  '<span style="color: #15cc08;">弃权(投票)</span>';}
                                if (d.operatorType==7) {return  '<span style="color: #15cc08;">补签</span>';}
                                if (d.operatorType==8) {return  '<span style="color: #cc0c00;">驳回</span>';}
                                if (d.operatorType==9) {return  '<span style="color: #cc0c00;">驳回到发起人</span>';}
                                if (d.operatorType==10) {return '<span style="color: #cc0c00;">删除任务</span>';}
                                if (d.operatorType==11) {return '<span style="color: #15cc08;">代理任务</span>';}
                                if (d.operatorType==13) {return '<span style="color: #15cc08;">锁定任务</span>';}
                                if (d.operatorType==14) {return '<span style="color: #15cc08;">任务解锁</span>';}
                                if (d.operatorType==15) {return '<span style="color: #15cc08;">添加意见</span>';}
                                if (d.operatorType==16) {return '<span style="color: #15cc08;">任务指派</span>';}
                                if (d.operatorType==17) {return '<span style="color: #15cc08;">设定所有人</span>';}
                                if (d.operatorType==18) {return '<span style="color: #15cc08;">结束任务</span>';}
                                if (d.operatorType==19) {return '<span style="color: #15cc08;">更改执行路径</span>';}
                                if (d.operatorType==20) {return '<span style="color: #15cc08;">收回任务</span>';}
                                if (d.operatorType==21) {return '<span style="color: #15cc08;">结束流程实例</span>';}
                                if (d.operatorType==22) {return '<span style="color: #15cc08;">保存流程草稿</span>';}
                                if (d.operatorType==23) {return '<span style="color: #cc0c00;">删除流程草稿</span>';}
                                if (d.operatorType==24) {return '<span style="color: #15cc08;">办结转发</span>';}
                                if (d.operatorType==25) {return '<span style="color: #cc0c00;">追回</span>';}
                                if (d.operatorType==26) {return '<span style="color: #15cc08;">任务交接</span>';}
                                return "";
                            }
                        }
                        , {field: 'memo', title: '备注',  sort: true, align: 'center'}
                        , {fixed: 'right', title: '管理', toolbar: '#bar', width: 150, align: 'center'}
                    ]]
                    ,done:function () {
                        commons.reflashDate({startName: '#createTime', endName: '#endCreateTime'});
                    }
                });
                totalFilter.init('processInstanceMyLogTable');
            }

            table.on('toolbar(processInstanceMyLogTable)', function (obj) {
                switch (obj.event){
                    case 'query':
                        common.tableConditionRender("processInstanceMyLogTable","instanceQueryForm",{where:{}},false);
                        break;
                    case 'reset':
                        common.tableConditionRender("processInstanceMyLogTable","instanceQueryForm",{where:{}},true);
                        break;
                }
            });
            //监听行工具事件
            table.on('tool(processInstanceMyLogTable)', function (obj) {
                var data = obj.data;
                switch (obj.event) {
                    case 'detail':
                        layer.open({
                            type: 2,
                            title: "流程明细",
                            shade: 0.3,
                            left: 200,
                            area: ['800px', '400px'],
                            btn:['关闭'],
                            skin: 'btn-close',
                            btnAlign: 'c',
                            yes: function(index,layero){
                                layer.close(index);
                            },
                            content: serverPath.workflowPath + setter.workflowLinkPath + 'bpmRunLog/view/get?id=' + data.id
                        });
                        break;
                }
            });

            commons.reflashDate({startName: '#createTime', endName: '#endCreateTime'});
            window.Initialization = function () {
                commons.reflashDate({startName: '#createTime', endName: '#endCreateTime'});
            };
            common.tableSort("processInstanceMyLogTable",{show:window.Initialization});
        });




    </script>
    <style>
    .layui-table-tool-temp {
    padding-right: 0px;
}
        .btn-close .layui-layer-btn{
            text-align: center;
        }
        .btn-close .layui-layer-btn a{
            display: inline-block;
            height: 38px;
            line-height: 38px;
            padding: 0 18px;
            background-color: #FF5722;
            color: #fff;
            white-space: nowrap;
            text-align: center;
            font-size: 14px;
            border: none;
            border-radius: 2px;
            cursor: pointer;
        }
        .btn-close .layui-layer-btn0{
        background-color: #FF5722;
        }
    </style>
</body>
</html>